package com.shoppingmall.mainfragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.example.zyh.toolslib.base.BaseFragment;
import com.example.zyh.toolslib.utils.GlideCacheUtil;
import com.example.zyh.toolslib.widget.TitleBar;
import com.shoppingmall.R;
import com.shoppingmall.activity.mine.AddressManageActivity;
import com.shoppingmall.activity.mine.ConsumeRecordActivity;
import com.shoppingmall.activity.mine.InvoiceActivity;
import com.shoppingmall.activity.mine.MineCollectActivity;
import com.shoppingmall.activity.mine.MineConsumeCoinsActivity;
import com.shoppingmall.activity.mine.MineDealersActivity;
import com.shoppingmall.activity.mine.MineQRCodeActivity;
import com.shoppingmall.activity.mine.MineOrderActivity;
import com.shoppingmall.activity.mine.MineQRCodeActivity;
import com.shoppingmall.activity.mine.MineScanHistoryActivity;
import com.shoppingmall.activity.mine.ModifyPwdActivity;
import com.shoppingmall.activity.mine.PersonalInformActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 2020/3/7
 * 描述：
 */
public class MineFragment extends BaseFragment {


    @BindView(R.id.title_bar)
    TitleBar titleBar;

    @Override
    protected void initView(View rootView) {
    }

    @Override
    protected int initLayout() {
        return R.layout.fragment_mine;
    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.iv_user_avatar, R.id.ll_collect_goods, R.id.ll_collect_stores, R.id.ll_scan_history,
            R.id.ll_pending_payment, R.id.ll_to_be_shipped, R.id.ll_to_be_received, R.id.ll_to_be_evaluated,
            R.id.ll_return_or_replace, R.id.ll_consume_currency, R.id.ll_consume_history, R.id.ll_change_pwd,
            R.id.ll_mine_qr_code, R.id.ll_mine_dealers, R.id.stv_address_manage, R.id.stv_clear_cache, R.id.stv_question,
            R.id.stv_invoice, R.id.stv_customer_service, R.id.stv_mine_post, R.id.stv_mine_comment})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_user_avatar:
                ActivityUtils.startActivity(PersonalInformActivity.class);
                break;
            case R.id.ll_collect_goods:
                Bundle bundle = new Bundle();
                bundle.putInt("selectPos",0);
                ActivityUtils.startActivity(MineCollectActivity.class,bundle);
                break;

            case R.id.ll_to_be_evaluated:
                Bundle bundleGoods = new Bundle();
                bundleGoods.putInt("selectPos", 0);
                ActivityUtils.startActivity(bundleGoods, MineCollectActivity.class);
                break;
            case R.id.ll_collect_stores:
                Bundle bundleStore = new Bundle();
                bundleStore.putInt("selectPos", 1);
                ActivityUtils.startActivity(bundleStore, MineCollectActivity.class);
                break;
            case R.id.ll_scan_history:
                ActivityUtils.startActivity(MineScanHistoryActivity.class);
                break;
            case R.id.ll_pending_payment:
                Bundle bundle1 = new Bundle();
                bundle1.putInt("state", 1);
                ActivityUtils.startActivity(bundle1, MineOrderActivity.class);
                break;
            case R.id.ll_to_be_shipped:
                Bundle bundle2 = new Bundle();
                bundle2.putInt("state", 2);
                ActivityUtils.startActivity(bundle2, MineOrderActivity.class);
                break;
            case R.id.ll_to_be_received:
                Bundle bundle3 = new Bundle();
                bundle3.putInt("state", 3);
                ActivityUtils.startActivity(bundle3, MineOrderActivity.class);
                break;

            case R.id.ll_return_or_replace:
                break;
            case R.id.ll_consume_currency:
                ActivityUtils.startActivity(MineConsumeCoinsActivity.class);
                break;
            case R.id.ll_consume_history:
                ActivityUtils.startActivity(ConsumeRecordActivity.class);
                break;
            case R.id.ll_change_pwd:
                ActivityUtils.startActivity(ModifyPwdActivity.class);
                break;
            case R.id.ll_mine_qr_code:
                ActivityUtils.startActivity(MineQRCodeActivity.class);
                break;
            case R.id.ll_mine_dealers:
                ActivityUtils.startActivity(MineDealersActivity.class);
                break;
            case R.id.stv_address_manage:
                ActivityUtils.startActivity(AddressManageActivity.class);
                break;
            case R.id.stv_clear_cache:
                GlideCacheUtil.getInstance().clearImageAllCache(mActivity);
                ToastUtils.showShort("清除成功");
                break;
            case R.id.stv_question:
                break;
            case R.id.stv_invoice:
                ActivityUtils.startActivity(InvoiceActivity.class);
                break;
            case R.id.stv_customer_service:
                Intent intent = new Intent(Intent.ACTION_DIAL);
                Uri data = Uri.parse("tel:" + "15238092390");
                intent.setData(data);
                startActivity(intent);
                break;
            case R.id.stv_mine_post:
                break;
            case R.id.stv_mine_comment:
                break;
        }
    }
}
